package com.thread;

public class ThreadState003 {

    static class T1 extends  Thread{
        @Override
        public void run() {
            for(int i=0;i<10;++i){
                System.out.println("i="+i);

                try {
                    Thread.sleep(200);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
    }

    public static void main(String[] args) {
        T1 t = new T1();
        System.out.println("s1"+t.getState());//NEW

        t.start();
        System.out.println("s2"+t.getState());//RUNNABLE

        try {
            t.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("s3"+t.getState());//TERMINATED


    }
}
